#include "sTextureResource.h"
#include "sGui.h"

namespace sgui
{

DEFINE_FABRIC(fbResourceModule, new res::sTextureResourceModule(gui, *file.getName()));

namespace res
{

const std::wstring sTextureResource::RESOURCE_NAME = L"TEX";

#ifdef _EDITOR
void sTextureResource::exportRTTI(rtti::sInfoList& list)
{
    sResource::exportRTTI(list);
}
#endif

CONTAINER_WRAPPER(res::sTextureResourceModule)& sTextureResource::getModules()
{
	return m_modules;
}

const CONTAINER_WRAPPER(res::sTextureResourceModule)& sTextureResource::getModules() const
{
	return m_modules;
}

CONTAINER_WRAPPER(res::sTextureResourceFrame)& sTextureResource::getFrames()
{
	return m_frames;
}

const CONTAINER_WRAPPER(res::sTextureResourceFrame)& sTextureResource::getFrames() const
{
	return m_frames;
}

void sTextureResource::load(const db::Record &file)
{
	sResource::load(file);
	m_modules.load(file[L"modules"], fabric::fbResourceModule);
}

void sTextureResource::save(db::Record &file) const
{
	sResource::save(file);
	m_modules.save(file[L"modules"]);
}

void sTextureResource::clear()
{
    sResource::clear();
	m_modules.clear();
}
        
preset::sPreset* sTextureResource::getPreset(const std::wstring& name)
{
    return new preset::sTexturePreset(getGui(), name, *this);
}

sTextureResource::sTextureResource(sGUI&gui, const std::wstring& name) :
    sResource(gui, name), m_modules(gui), m_frames(gui)
{
    //
}

sTextureResource::~sTextureResource()
{
    //
}

};
};